import requests


def send_request():
    '''
    爬取网址(全国建筑市场监管服务平台)：
    https://jzsc.mohurd.gov.cn/data/company

    :return 返回爬取的数据
    '''
    # 爬取平台网址
    url = 'https://jzsc.mohurd.gov.cn/APi/webApi/dataservice/query/comp/list?'

    data = {
        'pg': 0,
        'pgsz': 15,
        'total': 0
    }

    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
    }

    response = requests.get(url=url, params=data, headers=headers)
    text = response.text
    print('爬取平台网址：', response.url)
    # print(text)  # 返回体加密了

    # 浏览器中搜素解密函数 decrypt  / 加密函数 encrypt
    return text


from Crypto.Cipher import AES
def aes_cbc_decrypt(encryptContent):
    '''
    AES 模式 CBC 解密函数

    :param encryptContent:加密字符串
    :return:返回解密结果
    '''
    key = 'jo8j9wGw%6HbxfFn'.encode()
    iv = '0123456789ABCDEF'.encode()
    # encryptContent = '95780ba0943730051dccb5fe3918f9fe1b6f2130681f99d5620c5497aa480f13f32e8cc4b2f871a9a59a1d0117ce9456ce6b66396085eaa2822aa2ffc121eac1885d297bbd68dcda88cd8b0b29e282f9fd6b8392d52b817608665d8a565119f3346fb19449490842b923ec5781524595bc078b2c15e47473f15860e2ed45c9dbab5a750581a26fcb22b99228eb09b541e83ac3724f373a7512ac3827fa40354d1e9af350488194daf6b0317870a9a65dee320e0d4cb84708b25e383c02095c17f20d09fb39ab6e1a150c85818ecc2a31c384412859eff0026319094965cffffbc42c9495ee35f03b2440b8baac751927c38b616dc2042a64223fa6a72f1dc685fcbb38fd7cc47f1efbc9f5bd2c7490e58fbd36cf5a3b4be852fac87c6e682bb7d554b9990431e2d550d914754c6ac899fef97980084a6ba4bfda771be81ea11fd1542b6ffafe1439be2c94f74f6a83bfce6d2bc2e9dc1d86b84eeb85c2b8dda8846d65232148f9d88ac4a675d2049c1ac6efae1e4a5f4a106f0e627fb89199d9491303a792672832269e9a5cc208be00fbf1baf342262ebdbef5eaf3a50a52eeae2811f2813697018bf103df428dc0d496af435d2384b2198000add245d87233c3955695a6daa1bb4bc5a8657b2c9dfbf9f4067097df759f5724a5cb3a747a58509e2f22da6cbcdd29ba95dc555cd40cba6d0a2eced0b15ece067bc949dce784b2ceb06a61e9f7dc8943445da701c15fc7053f2c21ea1fc877e02280d22f913983c6f1dead091312c37aa90a5967b71b4c34dab24468bde5f747d8f44f8fd4b0fa493ff49b92441a7e1e8c256a6a18573baa1bf16f5093e36a7c9e282a3156db85e3da608e1cdd8af14af1b63499e6fba59cca04774b400b60894587466be97548472f4c56857e0242d2bd9ced382ab95ce290b3ad166c0274c4768082e36ba83509427a927eb67300a42647f416d852f1b304ba0344b8d879b8d38ed372c4d74c488dbdb016eb80087e15ec172a44fdf947f75b4da164d377fa81733af92eff108ada9492add4da03598c594036640b6a8349e7c64f9b0f86e1ce157ae2262bc5efc20dc8e5fc2c805972d61fa907445bf62874b86cb7ded2b3c652a5ee35e960c7fc0f80d8704cecf7da6f4de34ca80d703df9b1c8daa77fb94a4a0285c2ca84e06907fc47ae53e9aee64fcb4ebd52b6cf8fa8278151a169471580ddf17d7e8f678ab79f0681672bbba220a76440e3421ebc2da87e2d791df5442b07e1fdf1b5dcc3c8c2116eaafeebe9fc35a579e08a38d04587e55eb7a4e5b34d2421a1ebf5ca3f0324ae9b71e68648f2978fff4a167bae092025f0eef78b582be6057d60f851cabb45d62a5b6fceb8deb4e1f3538047fb2d5113092cce6cf7a6aa8cde1f3da6ae516d19fb5bc3c7e3e5e72b17548397619f1b7194e96c2488017ee066940469398a707c0dc468ddb248a8ffb9c1cd7d50378f43388b9948c313fa7f8411c23411be8a19152f6a81d68c1fe3588532bed9cf23898b3126632efc80b5cbce6d178e26995e5f86deeadc7eccd511ac42cc928f6832ffdf4e2c01b553afa687d016ad973c5c57461a692340085fde6145330781ef28da313ae4c50fa7638a8a7a6c22beabaa67dba12fc0a7d44fc93228e98d7c435601cf7a054ed557bebeb0f137f0ada6d6eadb0bce7f57d20d9232f90c1cd58e87fdb439e4c29f58b04c30ec1d7a75a91d5e4281680a7187b044f559e924acda07f4914362ced2338193519320f6dd0901f66463543145a971bd92003c6337e7d5880028e93859842fe5ae390e7571bdef4e7f2e69d5cdf34912847f9b29fcc7bcecf320471377dbc31228a63fb163f8fdb8358e565fc86c7a257d36d1a3581476ef73a46ac77b852524c9a04128d45962fed0251bb26c6ebd1ea77d7cf9ebd2cfa53edfbea2fe7312f5c73f311670037a85465ea144d1fe5aed54c8a71168262b05ca761c0a1cb6c081d6114a820a23409e88ae95560629e97640b919183be6cbb87de32c2c52fd84e3cd65b2be00d51bc6356ee61cef1453a207eec877dc63e3a51941b021ff599cf68475b46813bdd8148de4413f3a1998dff278ce4df67704033b108e363f7da222a0374b12f7a5d678b8842eb7c4f2d764f6d77e87f3adf5552c9b55ae2f9a6969842e9f708c8960dcbdea1530384b69fa10c92704973fb69e63ad6217263e783b7d3f70368645c101189eb79207795636065bd0fd3843a2fb3762e724fbc6370b10b5bf92d00b2792453e8cf7af5b470c2185ec6615fdef9f0f529605dc99aa13270ebbdbe8ecf8fc99ceea7717f3d12334832d80bcf82f40121868c33e933ef700647551e4d2ce8d0fe565856cfdb8e0ad504c95bc66afa86658090091b49bfb3c1e1254abe3034554e538a911f615b3d3ce7a4962062fd1dc150729c5ddb4a80ae4b818407ca7354d4cf39c10ec96f9675103c1c20e9e3e6348bcc5446660d2676b0fa80283dfe8f216b693820c596416039a0665d66133622f30b3f4c65253f02c91bda7489ef033bb4b16cfe87b2268a80b9f14fad4fa15446a3a7ae5ef866a3d0735e5f18a97be3993aa9ec67d9223092a109cfad0e3cf6c0107f05401ffabd99d113fd756151a51073d7655d58e463a1cdc58ca14e8bf8512ab0338fcd64b38805bb722f3d15b0e6e6d63fca9e1c6d248953f7fd5b6a37b1bfdfbaf32802fd76a27a2d34d93479b1063455432569872f3644265d9ef3158d8ce288347badb7728a2ea1ff7902e30b1d088b523a2180852e7ac7fc150a134d3df22671c1e9502769793ba4602ec1a075ca33ee57f9661ba12a98738c1a32adf07119a65a6236c4802cc28c8e726997a000a570d7c2ca3522ff7298aa29c3b78a3018363884fe635f1562fb467bb5988fcb67bf84449e9ca8c14531f976036d20390dc420346972001c5a38b7c68bf5c212a1b21892869b077f44933b91625e4bf658eb426632b83182f4d00457a19dc28f4e63f5f28a6f62624aab3c512e3a52648e0b31779a23e95c1b4525b3a78ee813ecdd5db78eeee50a610d70faf04baa5f2b58c268462b1d336de258ef5c9b61c14cfb1b3641a80e51a9af0e2d5b748e88b59cd4e91e18658adbf1d9a3efaa322f837c33bd602a18d980c545b3bb4df1844a3b9dd457939fd2b56eb5baf80e1bc542001d9032faec302c9afcbc0151c4a44c9df22e5fa7fc21daca11a30df48d8835e209fb4f9d89be17e073b0b8b17d955b975d1daf0b86fda95e2538a0057ef5f5da4752b9f2e913844178c86c03a9efa4a38792165662a471057d0b77ed6ec1c296ad9e3e9cffe706353c9f3c4a55417712123aa70b21c023166920ab0aaa3a0832fa71725cccfba4a52b2cc0022f51a59b4daa66922d02c507563637687d7ab58808119521d2a3a9aab3dc8ed26a5d309e99ce96e04cb4702f24252dffa63fc62a12e03e6ffb950eefe3d9e921a9f26fdf7a1f451b42d37d470c108a76295cb43858d22ca93f5e2d6bbefc8e1cd306d6154fefd0ba540b7d6ca8f31565fc81577b722d399edd2f307dde879bb1478e311c2fc40c758074b4d92bf19bd41235a34e2c82b91b212879b9325b4535a6ed779b7e64fa6032ba3c02fbc6067e27b503943d8326b6d87198f6bd64736db9f24a76c698bfd974ebe3daf123cb106aa10ae4d3987cf1c5d0e45869e9964bbfad2996be13fdc5fdfe7b276e489b9a6ac7217125354ccd6722c3456b1d8f48eff7b2f31b62101aac28ae37da5c88238a365ec578c9af62d0eb079bf5e9a9e31b6a92466523e3e734938f611a7bc55d04a9cf39bb98190a9324e48362dbe130f88009e66e71ed5761b8cfce86c99c168bef10dd33fe20ee9182d827e81abbf708115b919eb2b5f304012aedf79bc8d30e03d778406309bc99e7dd2e2b18709ef337678f04490899ccb89971e82eebd94a8fe18cd2f8ae1460d0e23788594a754d1591cd90941f908dcad79511a34eb77c490bd2dc4404119824cfde322b8ab16b3003b2b7464e1a398f4cc740288b01a2ac109585ed8ee4f7067c3eb8011de81f6165cc5bee1eae9460c86a8520a7dfc81e581c007c113da4613e1634ee7a31fc24b3f137a0b3b80d655890c7be1bf08dbbe06ebf36e354f2653c0bb01825dea79f9f651dff73c5c94dd5bd9e0d85c6c53c4042430c8252259c6775eb6526f8f29c70b9c24416398387a4764201014621e439108b14647d88f05e09a4587e641a328d06403929b72ffef2b669e031a7edfeff9c6e1649b08a92dc65623490c7ef23ca9a89dfa2d3ae0f877a00ffd0eb92ec333899d75d6b9a1bf6f6d9f2dd1bea9810ae44a8f5e7b885a4e406a2af91b24a408446b1a708ce67903b93156441cb24c29de18283a4f619315c2c59fb4ac9afe4afaa18fb2e633af3d40ad0f264f39c39985f8091281afe22fe8cf7838b1e4521a8c25624ded3bb012609ccdea0241187fa6da2bf6ab5a38b471072f4b54bbf2dce02a29a66d34be2b8ec6b2ec9bd9a0f69afec4589891ccce42a6ac5e86d6797ca86e6cebe0caa84080841f3d97590642c785870319e3be8b156bcd0c45e7c4d6e23b0b5132dcb103496f9c11a207ea7a0f1c93d1111deeadef67ee7b429f17524d0dded6bbd085ea5b5f840f4c43765df69003f026b0df7cc5ba1816369c4c4b74cd7601b690e0c8bd4c70b4ac59880205773bee00235121042f54248ca7f5e9612ea2fe9ba447a64df8833673712285be62419e2941b276c77489765c5b22f494ef61976801e9c97d3df07ce805fa49873489432421a8e05b60879797f8241c05d15498c2d67d0c872acc68cf5d3fa175b5334e39f9b0f3e2c15b039a1633741f90c747e2dad2028ba5a6284cec19303f3f54406c285371552a7b5cbd2c1a218efbc7f397aa4f8d5842ad5d3cf56e64b142aa05c15089ed52cfc72df0816c44162cde7d304c374d7dc16fda96f4a589cecc4e822f056a92bdc75ccdb174a800cb74f79ed2030733446cd609a1500b928d096469a36173bcb631e9f4cde6613f284bc376a35942acb5014c920c6f30159cd1b086f7dedc0360877b17c05a672978d0055a4f03b502d1e2f0848bce6caef1c64565a6693456f376e9fea5bc6d7d98ed53a51826e8bd9a160f2e48f6ceddd8bfc4ec398a6aef6bbd20961cfb799450a5eac9e6e415e44e86e8106489d3d37f764d56779e42560e048df6ccb438601aa56b016ba707fc44de9cb820e3d73e9a6c7c8594f602d42e1845bb43d8ea5062fb33cf82c4b0e0bb6ee21e96e48217707d0c82683517f71f15269718a1260fdcd77481c1dbc3201a7e17b581e650c15aa60c27269bb9ae74fb4c6fcf6d5b1a686067cc64ddd729bd7113f47d6e999c0583259e382c54a3207df633626d95b7b69aa73ecbf2f2034106ade8b9ba35df1fdee9e8083ee804c840dbb91f80956e3970133b066d36547d37af5f3f88ac75c263416861a07a678ed6ad34edeb02de5bfd0f53c278aac2a01ab58c04464dfa9b4de90753e25f359a7a240da9a68c92e78a23acc3524cc9d0e89631ef3683007de97055c0a9b4673060e2b7c46d35d3163fc2dff6da9bfb2a8b9465aada82ced5fdf7f9f9aef43f47a18adceb01fa11540b49dc85b0f2c0d69a90fabbabaa9276e97ad34736de6f8194ee02928617146fb9cbfa7947d1096bd0fc991364e6e9d67a4e81578af1aa0156f748488936778c960b9c033cd1ed5b4291da2c575674f858d4cdd5e7018dde947ad643903325bbdcdd80ce6b4577a5e1e09920f87f8557277972cc4f63b88d903896833e2395496912b6ddfedf0796bdec03c2f57f5e88c78f2e3b6eac681afd0178430b82264f4874390198d3622053d550d9580e823400f5e7889dde58acc437fd374f3fe8313021fd372b542105cc05e4a541d2d0795990d8377d1fd40a48e01b3748fcae6583dfb32e16f1c484ae3edd4442aca6171412d387637213731ad0b1dd70bd02257d3c387787c5dfe4abd08fd2981453ab397b3f49e99b401bd9ca0906c91ab835144896170bf7aedb8c4fa39a6a3fad8151c161bcca555e3f81fc60c8a22fdb05af6b7d069d5a774a2d5bc6b26949fb39c50548328504ce074baac6521056cec9b77c184d5ea13ad21cdf3a76cec3920720670efbc16603bec3e4bcdd5b598d7030ef946196f0a5879067a18cf798b501d0af'

    # 字符串转字节
    text = bytes.fromhex(encryptContent)
    # key = key.encode()
    # iv = iv.encode()
    aes = AES.new(key, AES.MODE_CBC, iv)
    plain_text = aes.decrypt(text).decode()
    # print('解密结果：', plain_text)
    return plain_text




if __name__ == '__main__':
    text = send_request()
    print('返回访问网址的加密数据：', text)

    dec_text = aes_cbc_decrypt(text)
    print('解密结果：', dec_text)







